﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.IO;

namespace HousingDistribution
{
    public partial class FormPersonDetailsTab : Form
    {
        public FormPersonDetailsTab()
        {
            InitializeComponent();

            InitControls();

            if (this.curIndex == 0)
                this.buttonPrevious.Enabled = false;
        }

        //初始化人员信息控件
        private void InitControls()
        {
            //初始化DataGridView控件
            InitDGVCurHousing();
            InitDGVSelectHousing();
            InitDGVPersonSearch();

            //军人tab控件
            CreateUnitComboxItem(this.comboBoxArmManUnit);
            CreateTechRankComboxItem(this.comboBoxArmManTechRank);
            CreateTechTitleComboxItem(this.comboBoxArmManTechTitle);
        }

        private void FormPersonDetailsTab_Load(object sender, EventArgs e)
        {
            //数据库中总人数
            this.personCount = GetPersonCount();

            if (this.personCount == 0)
            {
                this.buttonNext.Enabled = false;
                this.buttonDelete.Enabled = false;
            }
            else
                DisplayInfo(this.curIndex);

            this.Dock = DockStyle.Fill;
        }

        private void buttonExit_Click(object sender, EventArgs e)
        {
            //释放资源
            this.personTable = null;

            this.Close();
        }

        DataStruct2SQL sqlCreator = new DataStruct2SQL();
    }
}
